// Decompiled by Jad v1.5.8e2. Copyright 2001 Pavel Kouznetsov.
// Jad home page: http://kpdus.tripod.com/jad.html
// Decompiler options: packimports(3) fieldsfirst ansi space 
// Source File Name:   TimeChart.java

package org.achartengine.chart;

import android.graphics.Canvas;
import android.graphics.Paint;
import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.List;
import org.achartengine.model.XYMultipleSeriesDataset;
import org.achartengine.renderer.XYMultipleSeriesRenderer;

// Referenced classes of package org.achartengine.chart:
//			LineChart

public class TimeChart extends LineChart
{

	public static final String TYPE = "Time";
	public static final long DAY = 0x5265c00L;
	private String mDateFormat;

	TimeChart()
	{
	}

	public TimeChart(XYMultipleSeriesDataset xymultipleseriesdataset, XYMultipleSeriesRenderer xymultipleseriesrenderer)
	{
		super(xymultipleseriesdataset, xymultipleseriesrenderer);
	}

	public String getDateFormat()
	{
		return mDateFormat;
	}

	public void setDateFormat(String s)
	{
		mDateFormat = s;
	}

	protected void drawXLabels(List list, Double adouble[], Canvas canvas, Paint paint, int i, int j, int k, 
			double d, double d1, double d2)
	{
		int l = list.size();
		if (l > 0)
		{
			boolean flag = mRenderer.isShowLabels();
			boolean flag1 = mRenderer.isShowGrid();
			DateFormat dateformat = getDateFormat(((Double)list.get(0)).doubleValue(), ((Double)list.get(l - 1)).doubleValue());
			for (int i1 = 0; i1 < l; i1++)
			{
				long l1 = Math.round(((Double)list.get(i1)).doubleValue());
				float f = (float)((double)i + d * ((double)l1 - d1));
				if (flag)
				{
					paint.setColor(mRenderer.getLabelsColor());
					canvas.drawLine(f, k, f, (float)k + mRenderer.getLabelsTextSize() / 3F, paint);
					drawText(canvas, dateformat.format(new Date(l1)), f, (float)k + (mRenderer.getLabelsTextSize() * 4F) / 3F, paint, mRenderer.getXLabelsAngle());
				}
				if (flag1)
				{
					paint.setColor(mRenderer.getGridColor());
					canvas.drawLine(f, k, f, j, paint);
				}
			}

		}
		drawXTextLabels(adouble, canvas, paint, true, i, j, k, d, d1, d2);
	}

	private DateFormat getDateFormat(double d, double d1)
	{
		if (mDateFormat == null)
			break MISSING_BLOCK_LABEL_28;
		Object obj = null;
		SimpleDateFormat simpledateformat = new SimpleDateFormat(mDateFormat);
		return simpledateformat;
		Exception exception;
		exception;
		DateFormat dateformat = SimpleDateFormat.getDateInstance(2);
		double d2 = d1 - d;
		if (d2 > 86400000D && d2 < 432000000D)
			dateformat = SimpleDateFormat.getDateTimeInstance(3, 3);
		else
		if (d2 < 86400000D)
			dateformat = SimpleDateFormat.getTimeInstance(2);
		return dateformat;
	}

	public String getChartType()
	{
		return "Time";
	}
}
